
const showNav = (cname) => {
    let nav = document.createElement('nav');
    nav.className = `nav`

    nav.innerHTML = `
    <a class="${cname === 'home' ? 'active' : ''}" href='./home.html'>
    <span class="iconfont icon-shouye"></span>
    首页
    </a>
    <a class="${cname === 'sports' ? 'active' : ''}" href='./sportsCoures.html'>
    <span class="iconfont icon-icon_A"></span>
    运动
    </a>
    <a class="${cname === 'circle' ? 'active' : ''}" href='./circle.html'>
    <span class="iconfont icon-quanzi"></span>
    圈子
    </a>
    <a class="${cname === 'my' ? 'active' : ''}" href='./my.html'>
    <span class="iconfont icon-wode"></span>
    我的
    </a>
    `
    document.body.append(nav);
}

// 顶部导航
const showTopNav = function (cname) {
    const nav = document.createElement('nav');
    nav.className = 'topnav';

    nav.innerHTML = `
    <a class="${cname === 'sportsrun' ? 'on' : ''}" href='./sportsRun.html'>跑步</a>
    <a class="${cname === 'sportsride' ? 'on' : ''}" href='./sportsRide.html'>骑行</a>
    <a class="${cname === 'sportscoures' ? 'on' : ''}" href='./sportsCoures.html'>课程训练</a>
    `;
    document.body.prepend(nav);
}

module.exports = {
    showNav,
    showTopNav
}